import {createRouter,createWebHistory} from 'vue-router'
import Dashboard from '../views/Dashboard'
import Design from '../views/Design'
import Layout from '../views/Layout'
import Cost from '../views/Cost'
import Plan from '../views/Planning'
import Manufacture from '../views/Manufacture'
const routes = [
    {
        path:'/',
        name:'login',
        component:()=>import('../views/Login.vue')
    },
    {
        path:'/layout',
        name:'layout',
        component:Layout,
        redirect:'/dashboard',
        children:[
            {
                path:'/dashboard',
                name:'dashborad',
                component:Dashboard
            },{
                path:'/design',
                name:'design',
                component:Design
            },{
                path:'/manufacture',
                name:'manufacture',
                component:Manufacture
            },
            {
                path:'/cost',
                name:'cost',
                component:Cost
            },
            {
                path:'/plan',
                name:'plan',
                component:Plan
            }
        ]
    }
]

const router = createRouter({
    history:createWebHistory(process.env.BASE_URL),
    routes
})

router.beforeEach((to,from,next)=>{
   if(to.path=='/'){
    console.info(to)
   } 
   next()
})
router.afterEach((to,from)=>{
    
})
export default router